//
//  Auction_SpecialSaleDetailsUserInfo_Cell_WX.m
//  ZITHER
//
//  Created by weixin on 2019/5/30.
//  Copyright © 2019 weixn. All rights reserved.
//

#import "Auction_SpecialSaleDetailsUserInfo_Cell_WX.h"
#import "Auction_SpecialSaleBusinessInfo_VC_WX.h"


@implementation Auction_SpecialSaleDetailsUserInfo_Cell_WX

- (void)awakeFromNib {
    [super awakeFromNib];
    [self setUI];

}
- (void)setModel:(specialSaleSceneidDetails *)model{
    _model = model;
    [self.picUser sd_setImage:model.userAvatar];
    self.labUserName.text = model.userNick;
    [self.btnUserLocation setTitle:[NSString stringWithFormat:@" %@", model.province] forState:UIControlStateNormal];
    NSArray *array = [model.images componentsSeparatedByString:@","]; //从字符A中分隔成2个元素的数组
    [self.scr addScrImage:array imageHeight:300 Radius:6];
    
}
-(void)setUI{
    [self.picUser mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self).offset(15);
        make.top.equalTo(self).offset(6);
        make.height.width.mas_equalTo(60);
    }];
    [self.labUserName mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.picUser.mas_right).offset(8);
        make.centerY.equalTo(self.picUser.mas_centerY).offset(-10);
        make.height.mas_equalTo(14);
    }];
    [self.btnUserLocation mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.picUser.mas_right).offset(8);
        make.centerY.equalTo(self.picUser.mas_centerY).offset(10);
        make.height.mas_equalTo(14);
    }];
    [self.scr mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.equalTo(self).offset(0);
        make.top.equalTo(self.picUser.mas_bottom).offset(20);
        make.height.mas_equalTo(300);
        make.bottom.equalTo(self.mas_bottom).offset(0);
    }];
    

}

- (BaseLab *)labUserName{
    if (!_labUserName) {
        _labUserName = [BaseLab initCustomLab:@"商户名称" color:HexColor(0x333333) font:[UIFont fontWithName:@"PingFangSC-Semibold" size:14]];
        [self addSubview:_labUserName];
    }
    return _labUserName;
}

- (BaseBtn *)btnUserLocation{
    if (!_btnUserLocation) {
        _btnUserLocation = [BaseBtn initCustomBtnImageAndTitles:@[@"商户地址"] images:@[@"sku_定位"] color:@[HexColor(0x333333)]];
        _btnUserLocation.titleLabel.font = [UIFont fontWithName:@"PingFangSC-Regular" size:12];
        [self addSubview:_btnUserLocation];
    }
    return _btnUserLocation;
}


-(BaseImageV *)picUser{
    if (!_picUser) {
        _picUser= [BaseImageV initCustom:CGRectZero contentMode:2];
        _picUser.image = [UIImage imageNamed:@"探索_阴影"];
        _picUser.backgroundColor = [UIColor grayColor];
        [_picUser setCornerRadiusWithRadius:30 isMasks:YES];
        [[_picUser addTag]subscribeNext:^(id  _Nullable x) {
            Auction_SpecialSaleBusinessInfo_VC_WX *vc = [[Auction_SpecialSaleBusinessInfo_VC_WX alloc]init];
            [self.getNav pushViewController:vc animated:YES];
        }];
        [self addSubview:_picUser];
    }
    return _picUser;
}


-(BaseScrollView *)scr{
    if (!_scr) {
        _scr = [[BaseScrollView alloc]init];
//        _scr.backgroundColor = [UIColor redColor];
        [self addSubview:_scr];
    }
    return _scr;
}


@end
